package com.nf.db.handler.map;

import java.sql.ResultSet;
import java.sql.SQLException;

import static com.nf.db.RowProcessor.DEFAULT_ROWPROCESSOR;

public class BeanMapHandler<K, V> extends AbstractMapHandler<K, V> {

    private Class<?> beanClz;

    public BeanMapHandler(String columnName, Class<?> beanClz) {
        super(columnName);
        this.beanClz = beanClz;
    }

    @Override
    protected V createRow(ResultSet rs) throws SQLException {
        return DEFAULT_ROWPROCESSOR.toBean(rs, beanClz);
    }
}
